﻿using System;
using System.Collections.Generic;
using System.Reflection;

namespace Oxage.Common
{
	public partial class Plugin<T>
	{
		#region Public properties
		/// <summary>
		/// Gets or sets a plugin name.
		/// </summary>
		public string Name
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets a plugin description.
		/// </summary>
		public string Description
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets a relative path to embedded icon resource.
		/// </summary>
		public string Icon
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets a full path to the loaded assembly file.
		/// </summary>
		public string Filename
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets a loaded plugin type.
		/// </summary>
		public Type Type
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets a loaded plugin instance.
		/// </summary>
		//public T Item
		//{
		//  get;
		//  set;
		//}
		#endregion

		#region Public methods
		public T CreateInstance()
		{
			return this.Type != null ? (T)Activator.CreateInstance(this.Type) : default(T);
		}
		#endregion
	}
}
